package com.example.qxfw.ybzz.mapper;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.qxfw.common.entity.zy.EnviroStation;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
@DS("service")
public interface EnviroStationMapper extends BaseMapper {

    @Select("select StationID, StationName, Longitude, Latitude from envirostation")
    List<EnviroStation> selectStation();

    /**
     * 通过城市获取环境监测站点信息
     * @param city
     * @return
     */
    @Select("SELECT DISTINCT stationid, stationname " +
            "FROM envirostation " +
            "WHERE city LIKE concat('%',#{city},'%')")
    List<EnviroStation> selectByCity(String city);

    /**
     * 通过城市获取环境监测站点名字
     * @param city
     * @return
     */
    @Select("SELECT DISTINCT stationname " +
            "FROM envirostation " +
            "WHERE city LIKE concat('%',#{city},'%')")
    List<EnviroStation> selectByCity1(String city);

    /**
     * 通过站点名字查询站点id
     * @param stationname 站点名字
     * @return
     */
    @Select("SELECT stationiD " +
            "FROM envirostation " +
            "WHERE stationname LIKE concat('%',#{stationname},'%') ")
    List<EnviroStation> selectByStationNameOfEnviroStation(String stationname);
}
